package com.ye.zcswzlms.service.impl;

import com.ye.zcswzlms.mapper.LostpropertyMapper;
import com.ye.zcswzlms.service.ILostpropertyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 叶德辉
 * @since 2020-12-10
 */

@Service
public class LostpropertyServiceImpl implements ILostpropertyService {
    @Autowired
    LostpropertyMapper lostpropertyMapper;
////    @Autowired UsersServiceImpl usersService;
//    public boolean LostpropertyInsert(String src, String userId, String name, String attribute, LocalDateTime time, String location, String type, String divid){
//        Lostproperty lostproperty = new Lostproperty();
//        lostproperty.setSrc(src);
//        lostproperty.setTime(time);
//        lostproperty.setLostPropertyName(name);
//        lostproperty.setDescript(attribute);
//        lostproperty.setLocation(location);
//        lostproperty.setType(type);
//        lostproperty.setDivid(divid);
//        lostproperty.setCreatTime(time);
//        lostproperty.setUserId(Integer.valueOf(userId));
//        System.out.println("传进来的时间:"+time);
//        if("寻物启事".equals(divid)) {
//            lostproperty.setState("未找到");
//        }
//        if (lostpropertyMapper.insert(lostproperty)>0){
//            return true;
//        }
//        return false;
//    }
//    public List<Lostproperty> queryLostForPage(String type,int page){
//        IPage<Lostproperty> LostpropertyPage = new Page<>(page, 8);//参数一是当前页，参数二是每页个数
//        QueryWrapper queryWrapper = new QueryWrapper();
//        queryWrapper.eq("type",type);
//        LostpropertyPage = lostpropertyMapper.selectPage(LostpropertyPage, queryWrapper);
//        LostpropertyPage.getRecords().forEach(System.out::println);
//        return LostpropertyPage.getRecords();
//    }
//    public int queryNum(String type){
//        QueryWrapper qw=new QueryWrapper();
//        qw.eq("type",type);
//        List list = lostpropertyMapper.selectList(qw);
//        return list.size();
//    }
//    public int delPropertyById(int id){
//        int i = lostpropertyMapper.deleteById(id);
//        return i;
//    }

    @Override
    public Map<String, Integer> getUnFindPro(Map params)  {
        Map<String, Integer> rest = new HashMap<>();
        Map queryList =  new HashMap<>();
        queryList.putAll(params);
        rest.put(params.get("queryType").toString()+"启事",lostpropertyMapper.getUnFindPro(queryList));
        return rest;
    }
}
